package com.xja.mapper;

import com.xja.pojo.Permissions;
import com.xja.pojo.Role;
import com.xja.pojo.RoleExample;
import java.util.List;

import org.apache.ibatis.annotations.*;

public interface RoleMapper {

    @Insert("insert into role_permission values(#{roleId},#{PermissionId})")
    void addRolePermission(@Param("roleId")Integer roleId, @Param("PermissionId")Integer PermissionId);

    @Delete("delete from role_permission where roles=#{roleId} and permissions != 9")
    void delAllRolePermission(@Param("roleId")Integer roleId);

    @Select("select IFNULL(max(roles),0) from role_permission where roles=#{roleId} and permissions=#{i}")
    int findFlagByRidPid(@Param("roleId")Integer roleId,@Param("i")Integer i);

    @Update("update role_permission set permissions=#{i} where roles=#{id} and permissions=#{i}")
    void updateRolePermission(@Param("id")Integer id,@Param("i") Integer i);

    @Delete("delete from role_permission where roles=#{roleId}")
    void deleteRolePermissionByRoleId(@Param("roleId")Integer roleId);

    int countByExample(RoleExample example);

    int deleteByExample(RoleExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Role record);

    int insertSelective(Role record);

    List<Role> selectByExample(RoleExample example);

    Role selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByExample(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByPrimaryKeySelective(Role record);

    int updateByPrimaryKey(Role record);

}